package pers.cz.common.pub;

import javax.sql.DataSource;
import java.util.List;
import java.util.Map;

/**
 * @program: jef-orm
 * @description: 公共dao接口
 * @author: Cheng Zhi
 * @create: 2023-08-12 15:35
 **/
public interface CommonDao<T extends AbstractEntity> {

    public List<T> find(T abstractEntity);

    public List<T> find(T abstractEntity, DataSource dataSource);

    public int insert(T abstractEntity);

    public int insert(T abstractEntity, DataSource dataSource);

    public int override(T abstractEntity);

    public int override(T abstractEntity, DataSource dataSource);

    public int batchInsert(List<T> abstractEntitys);

    public int batchInsert(List<T> abstractEntitys, DataSource dataSource);

    public int update(T abstractEntity);

    public int update(T abstractEntity, DataSource dataSource);

    public int delete(T abstractEntity);

    public int delete(T abstractEntity, DataSource dataSource);

    public <T> List<T> selectAs(String sql, Class<T> resultType);

    public <T> List<T> selectAs(String sql, Class<T> resultType, DataSource dataSource);

    public <T> List<T> selectAs(String sql, Class<T> resultType, Map<Integer, Object> map);

    public <T> List<T> selectAs(String sql, Class<T> resultType, Map<Integer, Object> map, DataSource dataSource);
}
